Class HCC.DT.HCC2HL72.ChkOrdStusUpd Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='POOR_IN200902UV:POOR_IN200902UV' targetDocType='2.5.1:OMG_O19' create='new' language='objectscript' >
<assign value='source.{id().extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime().value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"SQM"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"S25"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().subject().patient().id.item(2).extension}' property='target.{PIDgrp.PID:PatientID.IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().subject().patient().choice.patientPerson.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PID:PatientName(1)}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().location.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Bed}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().location.asLocatedEntityPartOf().location().name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Room}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Facility}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.asOrganizationPartOf().wholeOrganization.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Floor}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().id().item().extension}' property='target.{ORCgrp(1).ORC:PlacerOrderNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().performer().choice.assignedEntity().id.item().extension}' property='target.{ORCgrp().ORC:OrderingProvider(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().performer().time.low.value}' property='target.{ORCgrp().ORC:OrderingProvider().EffectiveDate}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().performer().choice.assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{ORCgrp().ORC:OrderingProvider().FamilyName}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().location().serviceDeliveryLocation().serviceProviderOrganization.name},"//s:item/s:part/@value")' property='target.{ORCgrp().ORC:OrderingFacilityName(1).OrganizationName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().location().serviceDeliveryLocation().serviceProviderOrganization.id().item().extension}' property='target.{ORCgrp().ORC:OrderingFacilityName().IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().component1().choice.processStep().code().code}' property='target.{ORCgrp().ORC:OrderStatusModifier.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().component1().choice.processStep().code().displayName.value}' property='target.{ORCgrp().ORC:OrderStatusModifier.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().code.displayName.value}' property='target.{PIDgrp.PV1grp.PV1:AdmissionType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().id().item().extension}' property='target.{PIDgrp.PV1grp.PV1:VisitNumber}' action='set' />
</transform>
}

}
